package cn.ly.jmockittest.model;

/**
 * Created by liuyu21 on 2017/10/22.
 */
public class User {

    private Long id;
    private String userName;
    private String password;

    public User() {
    }

    private User(Builder builder) {
        setId(builder.id);
        setUserName(builder.userName);
        setPassword(builder.password);
    }

    public static Builder newBuilder() {
        return new Builder();
    }


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public static final class Builder {
        private Long id;
        private String userName;
        private String password;

        private Builder() {
        }

        public Builder withId(Long val) {
            id = val;
            return this;
        }

        public Builder withUserName(String val) {
            userName = val;
            return this;
        }

        public Builder withPassword(String val) {
            password = val;
            return this;
        }

        public User build() {
            return new User(this);
        }
    }
}
